﻿using System;
using System.Collections.Generic;
using Zero.Core.Domain;
using Zero.POCO.Audiences;
using Zero.POCO.FiltreEnumeration;
namespace Zero.POCO.Donnees
{
    public class Signalitique : EntityBase<Guid>, IAggregateRoot, ISignalitique
    {
        static List<int> _premier = new List<int>() { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113 };


        protected override void Validate()
        {
            throw new NotImplementedException();
        }

        //1 homme
        //0 femme 
        public Guid Id { get; set; }
        public Genre Genre { get; set; }
        public Vague Vague { get; set; }
        public Individu Individu { get; set; }
        public float Poid { get; set; }
        public RevenuTotalFoyer RevenueTotalFoyer { get; set; }
        public NbVoiture NbVoiture { get; set; }
        public NbChambre NbPiece { get; set; }
        public Habitat Habitat { get; set; }
        public TypeHabitation TypeHabitat { get; set; }
        public TailleFoyer TailleFoyer { get; set; }
        public bool PCConnexion { get; set; }
        public bool SecheLinge { get; set; }
        public bool LaveVaissele { get; set; }
        public bool Console { get; set; }
        public bool Camescope { get; set; }
        public bool Climatiseur { get; set; }
        public bool LecteurCD { get; set; }
        public bool Magnetoscope { get; set; }
        public bool AppareilPhotoNumerique { get; set; }
        public bool Congelateur { get; set; }
        public bool Pcsansconnexion { get; set; }
        public bool Aspirateur { get; set; }
        public bool LecteurDVD { get; set; }
        public bool LaveLinge { get; set; }
        public bool Chainestereo { get; set; }
        public bool Fourmicroonde { get; set; }
        public bool Telephone { get; set; }
        public bool Cuisiniere { get; set; }
        public bool Mobile { get; set; }
        public bool Decodeur { get; set; }
        public bool Lecteurradiocassette { get; set; }
        public bool Televisionencouleur { get; set; }
        public bool Refrigirateur { get; set; }
        public CSE CSE { get; set; }
        public SituationMatrimonial Situationmatrimoniale { get; set; }
        public StatutFamiliale Statutfamilial { get; set; }
        public NiveauInstruction Niveau { get; set; }
        public CSP CSP { get; set; }
        public int TrancheAge { get; set; }
        public int Age { get; set; }
        public int Ville { get; set; }
        public int Mois { get; set; }
        public int Jour { get; set; }


        public int GetFloatVersionPrioritaire()
        {
            int value = 1;
            switch (Genre)
            {
                case Genre.Homme:
                {
                    value = value*_premier[0];
                    break;
                }
                case Genre.Femme:
                {
                    value = value * _premier[1];
                    break;
                }
            }


            switch (CSP)
            {
                case CSP.Cadre:
                    {
                        value = value * _premier[2];
                        break;
                    }
                case CSP.CadreMoyen:
                    {
                        value = value * _premier[3];
                        break;
                    }
                case CSP.Chomeur:
                    {
                        value = value * _premier[4];
                        break;
                    }
                case CSP.Employee:
                    {
                        value = value * _premier[5];
                        break;
                    }




                case CSP.Etudiant:
                    {
                        value = value * _premier[6];
                        break;
                    }
                case CSP.FemmeFoyer:
                    {
                        value = value * _premier[7];
                        break;
                    }
                case CSP.HautFonctionnaireCadreSuperieurEtat:
                    {
                        value = value * _premier[8];
                        break;
                    }
                case CSP.Inactif:
                    {
                        value = value * _premier[9];
                        break;
                    }





                case CSP.Pensionne:
                    {
                        value = value * _premier[10];
                        break;
                    }
                case CSP.PetitPatron:
                    {
                        value = value * _premier[11];
                        break;
                    }
                case CSP.ProfessionLiberal:
                    {
                        value = value * _premier[12];
                        break;
                    }
                case CSP.Retraite:
                    {
                        value = value * _premier[13];
                        break;
                    }



            }
            switch (RevenueTotalFoyer)
            {
                case RevenuTotalFoyer.Entre12000et19999:
                    {
                        value = value * _premier[14];
                        break;
                    }
                case RevenuTotalFoyer.Entre20000et34999:
                    {
                        value = value * _premier[15];
                        break;
                    }
                case RevenuTotalFoyer.Entre35000et49000:
                    {
                        value = value * _premier[14];
                        break;
                    }
                case RevenuTotalFoyer.Entre50000et89000:
                    {
                        value = value * _premier[15];
                        break;
                    }



                case RevenuTotalFoyer.Entre90000et120000:
                    {
                        value = value * _premier[16];
                        break;
                    }
                case RevenuTotalFoyer.PlusDe150000:
                    {
                        value = value * _premier[17];
                        break;
                    }
                case RevenuTotalFoyer.Moins12000:
                    {
                        value = value * _premier[18];
                        break;
                    }
               
            }


            switch (CSE)
            {
                case CSE.A_ClasseAisee:
                {
                    value = value*_premier[19];
                    break;
                }
                case CSE.B_ClasseMoyenneSuperieur:
                {
                    value = value*_premier[20];
                    break;
                }
                case CSE.C_ClasseMoyenneInferieur:
                {
                    value = value * _premier[21];
                    break;
                }
                case CSE.D_ClasseDemunie:
                {
                    value = value * _premier[22];
                    break;
                }
            }

            switch (Niveau)
            {
                case NiveauInstruction.NiveauxMoyen:
                    {
                        value = value * _premier[23];
                        break;
                    }
                case NiveauInstruction.NiveauxPrimaire:
                    {
                        value = value * _premier[24];
                        break;
                    }
                case NiveauInstruction.NiveauxSecondaire:
                    {
                        value = value * _premier[25];
                        break;
                    }
                case NiveauInstruction.SansInstructionAnalphabet:
                    {
                        value = value * _premier[26];
                        break;
                    }

                case NiveauInstruction.SansInstructionMaisSaitLireEtEcrire:
                    {
                        value = value * _premier[27];
                        break;
                    }


                case NiveauInstruction.Universitaire:
                    {
                        value = value * _premier[28];
                        break;
                    }
            }



            return value;
        }

        public int GetFloatVersionSecondaire()
        {
            int value = 1;

            switch (Statutfamilial)
            {
                case StatutFamiliale.Autre:
                    {
                        value = value * _premier[0];
                        break;
                    }
                case StatutFamiliale.ChefFamille:
                    {
                        value = value * _premier[1];
                        break;
                    }
                case StatutFamiliale.EnfantChefFamille:
                    {
                        value = value * _premier[2];
                        break;
                    }
                case StatutFamiliale.MaitresseMaison:
                    {
                        value = value * _premier[3];
                        break;
                    }

           
            }




            switch (NbPiece)
            {
                case NbChambre.CinqChambreOuPlus:
                    {
                        value = value * _premier[4];
                        break;
                    }
                case NbChambre.DeuxChambre:
                    {
                        value = value * _premier[5];
                        break;
                    }
                case NbChambre.QuatreChambre:
                    {
                        value = value * _premier[6];
                        break;
                    }
                case NbChambre.TroisChambre:
                    {
                        value = value * _premier[7];
                        break;
                    }
                case NbChambre.UneCahmbre:
                    {
                        value = value * _premier[8];
                        break;
                    }


            }

            switch (NbVoiture)
            {
                case NbVoiture.Aucune:
                    {
                        value = value * _premier[9];
                        break;
                    }
                case NbVoiture.DeuxVoiture:
                    {
                        value = value * _premier[10];
                        break;
                    }
                case NbVoiture.TroisVoiturePlus:
                    {
                        value = value * _premier[11];
                        break;
                    }
                case NbVoiture.UneVoiture:
                    {
                        value = value * _premier[12];
                        break;
                    }


            }



            switch (Habitat)
            {
                case Habitat.Locataire:
                    {
                        value = value * _premier[13];
                        break;
                    }
                case Habitat.Proprietaire:
                    {
                        value = value * _premier[14];
                        break;
                    }
                case Habitat.Squatteur:
                    {
                        value = value * _premier[15];
                        break;
                    }
                
            }


            switch (TypeHabitat)
            {
                case TypeHabitation.AppartementImmeuble:
                    {
                        value = value * _premier[16];
                        break;
                    }
                case TypeHabitation.AppartementImmeubleStanding:
                    {
                        value = value * _premier[17];
                        break;
                    }
                case TypeHabitation.AppartementTraditionnel:
                    {
                        value = value * _premier[18];
                        break;
                    }
                case TypeHabitation.MaisonToile:
                    {
                        value = value * _premier[19];
                        break;
                    }
                case TypeHabitation.MaisonTraditionnel:
                    {
                        value = value * _premier[20];
                        break;
                    }
                case TypeHabitation.VillaIndependanteJardin:
                    {
                        value = value * _premier[21];
                        break;
                    }
                case TypeHabitation.VillaJumeleTerrain:
                    {
                        value = value * _premier[22];
                        break;
                    }
             

            }


            return value;
        }




        private List<AudienceTV> _AudienceTVs { get; set; }
        public List<AudienceTV> AudienceTVs
        {
            get
            {
               // return _AudienceTVs ?? (_AudienceTVs = GetAudienceTV());
                return _AudienceTVs = GetAudienceTV();
            }

            set { _AudienceTVs = value; }
        }
        public Func<List<AudienceTV>> GetAudienceTV{get;set;}



        private List<AudienceRadio> _audienceRadios { get; set; }
        public List<AudienceRadio> AudienceRadios 
        {
            get { return _audienceRadios ?? (_audienceRadios = GetAudienceRD()); }
            set { _audienceRadios = value; } 
        }
        public Func<List<AudienceRadio>> GetAudienceRD { get; set; }

        private List<AudienceJournal> _AudienceJournals { get; set; }
        public List<AudienceJournal> AudienceJournals
        {
            get{return _AudienceJournals ?? (_AudienceJournals=GetAudiencePresse());}
            set { _AudienceJournals = value; }
        }
        public Func<List<AudienceJournal>> GetAudiencePresse { get; set; } 



    }
}